package com.example.demo1.controller;

import com.example.demo1.domain.Team;
import com.example.demo1.domain.User;
import com.example.demo1.service.TeamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/team")
public class TeamController {

    @Autowired
    private TeamService teamService;

    @PostMapping("/create")
    public String createTeam(@RequestParam String teamName, @RequestParam String captainPhone) {
        teamService.createTeam(teamName, captainPhone);
        return "Team created successfully";
    }

    @PostMapping("/addMember")
    public String addMember(@RequestParam String teamName, @RequestParam String memberPhone) {
        teamService.addMember(teamName, memberPhone);
        return "Member added successfully";
    }

    @PostMapping("/bindTeam")
    public String bindTeam(@RequestParam String captainPhone, @RequestParam String memberPhone) {
        teamService.bindTeam(captainPhone, memberPhone);
        return "Team bound successfully";
    }
}

